﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowTeamMembers.aspx.cs"
    Inherits="Actuals.ShowTeamMembers" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript">


        function ShowAddTeamMember() {
            var teamId = document.getElementById("ddlTeam").value;
            var url = 'AddTeamMembers.aspx?TeamId=' + teamId;
            var result = window.showModalDialog(url, this,
                'dialogHeight:600px;dialogWidth:600px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }


        function UpdateAddTeamMember(teamMemberId) {

            var teamId = document.getElementById("ddlTeam").value;
            var url = 'AddTeamMembers.aspx?Mode=Edit&TeamId=' + teamId + '&TeamMemberId=' + teamMemberId;

            var result = window.showModalDialog(url, this, 'dialogHeight:600px;dialogWidth:600px;Status:yes;Toolbars:no;Scroll:yes;Help:no;Center:yes;');
            __doPostBack('refresh', 'refresh');
        }

        function TestCheckBox() {

            var Target = null;
            Target = document.getElementById('<% = this.gvResults.ClientID %>');
            if (Target == null) {
                alert("No record is selected.Please select!");
                return false;
            }
            var Inputs = Target.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == 'checkbox' && Inputs[n].checked) {
                    return confirm("Do you want to Delete?");
                }

            }
            alert("no record is selected.Please select!");
            return false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <center>
            <div>
                <asp:Label ID="Label2" runat="server" CssClass="ParaTitle">Team Members </asp:Label>
            </div>
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblTeam" runat="server" CssClass="label">Team
                        </asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList Width="75%" ID="ddlTeam" runat="server"  CssClass="textfield">
                        </asp:DropDownList>
                        <asp:Button ID="btnGetTeamMembers" runat="server" Text="GetTeamMembers" OnClick="btnGetTeamMembers_Click" />
                    </td>
                      
                </tr>
            </table>
            <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
            <div id="divGrid" style="border: solid 1px silver; height: 400px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="false" BorderColor="Black"
                    AllowPaging="false" AllowSorting="true" ShowFooter="true" OnRowCommand="gvResults_OnRowCommand">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkShowTeamMember" runat="server" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblTeamMemberId" runat="server" Text='<%# Bind("Id") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Employee">
                            <ItemTemplate>
                                <asp:Label ID="lblEmp" runat="server" Text='<%# getEmpName(Eval("EmployeeId")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="WorkMode">
                            <ItemTemplate>
                                <asp:Label ID="lblWorkMode" runat="server" Text='<%# getWorkMode(Eval("WorkMode")) %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="NoOfHoursPerDay" HeaderText="NoOfHoursPerDay" />
                         <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditTeamMember" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Id") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <asp:Button ID="btnAddTeamMember" runat="server" Text="AddTeamMember" CssClass="button"
                OnClientClick="return ShowAddTeamMember();" />
            <asp:Button ID="btnDelete" runat="server" CssClass="button" Text="Delete" OnClientClick="return TestCheckBox()"
                OnClick="btnDeleteTeamMember_Click" />
        </center>
    </div>
    </form>
</body>
</html>
